<%@page pageEncoding="utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<table width='100%' height='31' border='0' cellspacing='0'
		cellpadding='0'>
	<tr>
		<td width='40'
			background='${pageContext.request.contextPath}/common/images/index_26.jpg'>&nbsp;
			
		</td>
		<!--内容区导航开始-->
		<td align='left' valign='middle'
			background='${pageContext.request.contextPath}/common/images/ctitle_bak_center.jpg'>
			<span class="channel_title">图书管理
				<span style="color:#000;"> >> 查询图书信息  >></span> </span></td>
		<!--内容区导航结束-->
		<td align='left' valign='middle'
			background='${pageContext.request.contextPath}/common/images/ctitle_bak_center.jpg'>&nbsp;
			
		</td>
		<td width='13' align='right' valign='middle'
			background='${pageContext.request.contextPath}/common/images/ctitle_bak_center.jpg'>
			<img src="${pageContext.request.contextPath}/common/images/ctitle_bak_right.jpg" height="31" width="10">
		</td>
	</tr>
</table>

<table width='100%' border='0' cellspacing='0' cellpadding='0'>
	<tr height="10%">
		<td align="left" height='31' background='${pageContext.request.contextPath}/common/images/ctitle_bak_fcenter.jpg'>
			<form action="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=querybook" method="post">
				<table>
					<tr>
					<td width="10%"></td>
					<td><span style="fond-size:12px">  图书类名：</span></td>
					<td>
							<select id = "firstName" name="firstName" onchange="changetype()">
								<option value="">选择图书类名</option>
								<c:forEach items="${bookTypes}" var="booktype">
									<option value="${booktype.id}">${booktype.typeName}</option>
								</c:forEach>
							</select>
					</td>
					<td><span style="fond-size:12px">  图书类名：</span></td>
					<td><span style="fond-size:12px"></span>
						<div id="types">
							<select>
								<option>选择图书类名</option>
							</select>	
						</div>
					</td>
					</tr>
					<tr>
					<td width="10%"></td>
					<td>				
						<span style="fond-size:12px">  编          号:</span>
					</td>
					<td>
						<input type="text" id="no" name="no" style="WIDTH:80px">
					</td>
					<td>
						<span style="fond-size:12px">  书          名:</span>
					</td>
					<td>
						<input type="text" id="name" name="name" style="WIDTH:80px">
					</td>	
					<td align="center"><input type="submit" value="查询"></td>
				</tr>
				</table>
			</form>	
		</td>		
	</tr>
	
	<tr height="285px">
		<td width="100%" valign="top">				
			<div style="overflow:auto;">			
				<table cellspacing='0' cellpadding='0' width="100%"  border="1">				
					<tr class="tabhead">
						<th>序    号</th>						
						<th>编    号</th>
						<th>书    名</th>
						<th>分类名</th>
						<th>出版社</th>
						<th>作    者</th>
						<th>查看详细</th>
					</tr>
					<c:forEach items="${books}" var="book" varStatus="loopStatus">
						<tr>					
							<td align="center">${loopStatus.count+(thisPage-1)*10}</td>		
							<td align="center">${book.no}</td>
							<td align="center" >${book.name}</td>
							<td align="center" >${book.type}</td>
							<td align="center" >${book.publish}</td>
							<td align="center" >${book.author}</td>
							<td align="center" ><a href="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=showonebook&id=${book.id}">详细</a></td>
						</tr>
					</c:forEach>
				</table>
			</div>
		</td>
	</tr>
	<tr height="20px" align="right">
		<td>
			第${thisPage}页/共${allPage}页&nbsp;&nbsp;
			<a href="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=querybook&pages=first&name=${name}&no=${no}&type=${type}&tPage=${thisPage}">|第一页</a>|
			<a href="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=querybook&pages=previous&name=${name}&no=${no}&type=${type}&tPage=${thisPage}">上一页</a>|
			<a href="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=querybook&pages=next&name=${name}&no=${no}&type=${type}&tPage=${thisPage}">下一页</a>|
			<a href="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=querybook&pages=last&name=${name}&no=${no}&type=${type}&tPage=${thisPage}">最后一页</a>|
		</td>	
	</tr>
</table>

<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/ajax.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/sysManage/js/book.js"></script>
	<script type="text/javascript">
	var client=null;
	function changetype(){
		var typeid = document.getElementById("firstName").value;
		client = createRequest();
		url="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=gettype&id="+typeid;
		 client.open("post",url,true);
		 client.onreadystatechange = handleResult;
		 client.send(null);
	}
	function handleResult(){
		if(client.readyState==4){
			var response = client.responseText;
			var div = document.getElementById("types");
			div.innerHTML=response;
		}
	}

</script>